﻿namespace DimensionsHelper.LanguageService.Syntax;

public abstract class BindableSignature : Declaration, IBindableSignature
{
    private TypeBinding _binding;

    protected internal BindableSignature(SyntaxKinds kind, SyntaxToken declareKeywordToken, Identifier name,
        SyntaxNode? parent) :
        base(kind, declareKeywordToken, name, parent)
    {
        _binding = TypeBinding.Void;
    }

    public override bool IsSignature => true;


    /// <summary>
    ///     类型绑定
    /// </summary>
    public TypeBinding Binding => _binding;


    public void Update(TypeBinding binding)
    {
        SetChildField(ref _binding, TypeBinding.IsVoid, binding);
    }


    public override void AcceptVisitor<T>(SyntaxNodeVisitor<T> visitor)
    {
        Accept(visitor, Binding);
        base.AcceptVisitor(visitor);
    }
}